package com.pn.controller;

import com.pn.entity.Brand;
import com.pn.entity.Place;
import com.pn.service.BrandService;
import com.pn.service.PlaceService;
import com.pn.utils.PageBean;
import com.pn.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("place")
public class PlaceController {

    @Autowired
    private PlaceService placeService;

    //显示产地信息
    @GetMapping("/place-page-list")
    public Result<PageBean<Place>> placePageList(Place place){
        PageBean pageBean = placeService.placePageList(place);
        return Result.ok(pageBean);
    }

    //修改产地
    @PutMapping("/place-update")
    public Result placeUpdate(@RequestBody Place place){
        return placeService.placeUpdate(place);
    }


    //添加产地
    @PostMapping("/place-add")
    public Result placeAdd(@RequestBody Place place){
        return placeService.placeAdd(place);
    }

    //删除产地
    @DeleteMapping("/place-delete/{placeId}")
    public Result placeDelete(@PathVariable Integer placeId){
        return placeService.placeDelete(placeId);
    }

}
